package zk.weart.api;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zk.weart.core.aliyun.AliyunConfig;
import zk.weart.core.response.ResultData;

/**
 * @Author zjk
 * @Description:
 * @Date 2022/5/11 0:43
 **/
@RestController
@Slf4j
@RequestMapping("/test")
public class TestController {

    @Autowired
    RedisTemplate redisTemplate;

    @Autowired
    AliyunConfig aliyunConfig;

    @GetMapping("/api")
    public ResultData test(){

        log.info("test controller is success");
        redisTemplate.opsForValue().set("12","1");
        return ResultData.success();
    }


    @GetMapping("/ex")
    public ResultData ex() throws Exception {

        log.info(aliyunConfig.getAccessKeyId());
        log.info(aliyunConfig.getOssConfig().getEndpoint());
        log.error("test controller is error");
        throw  new Exception("出错啦");
        //return ResultData.success();
    }
}
